﻿using System;
using System.Runtime.InteropServices;
using SCG = System.Collections.Generic;

using Nemerle.Assertions;
using Nemerle.Utility;

namespace Nemerle.OpenCL.Utils {

    public module ArrayHelper {

        public static GetArraySize[T](buffer : Array) : uint {
            unchecked {
                mutable array_length = 1u;
                for(mutable dim = 0; dim < buffer.Rank; ++dim)
                    array_length *= buffer.GetLength(dim) :> uint;
                array_length * Marshal.SizeOf(typeof(T)) :> uint
            }
        }

    }

}